# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-07-10
# @File : 7_wx_split_img_get.py

import requests
import base64

res = requests.post(
    url='https://m.captcha.qq.com/',
    data='{"Action":"CheckCaptchaAppId_v1.0.1","CaptchaAppId":2075530305}',
)
esid = res.json()['Response']['SId']

res = requests.post(
    url='https://m.captcha.qq.com/',
    data='{"Action":"GetImageData_v1.0.1","ESId":"%s"}' % esid,
)
data_dict = res.json()

# 背景图片，base64
l_image = data_dict['Response']['ImageDataL']
l_image_content = base64.b64decode(bytes(l_image, encoding="utf-8"))    #
with open('l_image.png', mode='wb') as f:
    f.write(l_image_content)

# 缺口图片，base64
s_image = data_dict['Response']['ImageDataS']
s_image_content = base64.b64decode(bytes(s_image, encoding="ascii"))
with open('s_image.png', mode='wb') as f:
    f.write(s_image_content)
